home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Magazine / C_Tutorial / Part-13 / PatchLib / autodocs / patch.doc
Encoding:
Text File  |  1997-12-11  |  42.3 KB  |  1,061 lines

  1. TABLE OF CONTENTS
  2.  
  3. patch.library/AddPatchNotifyA
  4. patch.library/CreatePatchProjectA
  5. patch.library/FindPatch
  6. patch.library/FindPatchTagsA
  7. patch.library/GetPatchA
  8. patch.library/InstallPatch
  9. patch.library/InstallPatchTagsA
  10. patch.library/PatchAlloc
  11. patch.library/PatchFreeVec
  12. patch.library/RemovePatch
  13. patch.library/RemovePatchProjectA
  14. patch.library/RemovePatchTagsA
  15. patch.library/RemPatchNotifyA
  16. patch.library/SetPatchA
  17. patch.library/SetPatchProjectA
  18. patch.library/WaitRemovePatch
  19. patch.library/AddPatchNotifyA                   patch.library/AddPatchNotifyA
  20.  
  21.    NAME
  22.         AddPatchNotifyA -- Get messages, if a patch is changed. (V5)
  23.         AddPatchNotify -- varargs stub for AddPatchNotifyA(). (V5)
  24.  
  25.    SYNOPSIS
  26.         Error = AddPatchNotifyA( msgport, taglist )
  27.         D0                       A0       A1
  28.  
  29.         ULONG Error AddPatchNotifyA( struct MsgPort *, struct TagItem *);
  30.  
  31.         Error = AddPatchNotify( msgport, ...)
  32.  
  33.         ULONG Error AddPatchNotify( struct MsgPort *, ...);
  34.  
  35.    FUNCTION
  36.         Patch.library will immediately start sending out PatchNotifyMessages
  37.         (see patch.h) of PATCHNOTIFY_CLASS to the given message port, if
  38.         a patch is added, removed or changed.
  39.  
  40.         pnm_Code contains PATCOD_xxx values to indicate the kind of
  41.         change. For PATCOD_PatchInstalled and PATCOD_PatchChanged
  42.         pnm_Object will contain a pointer to the corresponding
  43.         patch structure.
  44.  
  45.    INPUTS
  46.         msgport = pointer to msgport ready to receive messages or
  47.                   null for no action
  48.         taglist = pointer to array of tags
  49.  
  50.    TAGS
  51.         PATT_Priority (BYTE) - Optional priority for the notification request
  52.                 Normally only the priorities +5, 0, -5 should be used.
  53.  
  54.    RESULT
  55.         Error = errorcode as defined in patch.h.
  56.                 PATERR_Ok
  57.                         Indicates success of the operation.
  58.                 PATERR_OutOfMem
  59.                         Indicates that there was not enough memory to
  60.                         complete the operation.
  61.  
  62.    NOTES
  63.  
  64.    BUGS
  65.  
  66.    SEE ALSO
  67.         RemPatchNotify(), patch.h
  68.  
  69. patch.library/CreatePatchProjectA           patch.library/CreatePatchProjectA
  70.  
  71.    NAME
  72.         CreatePatchProjectA -- Create an instance of a patch project. (V4)
  73.         CreatePatchProject -- varargs stub for CreatePatchProjectA(). (V4)
  74.  
  75.    SYNOPSIS
  76.         project = CreatePatchProjectA( projectname, taglist )
  77.         D0                             A0           A1
  78.  
  79.         APTR CreatePatchProjectA( STRPTR, struct TagItem *);
  80.  
  81.         project = CreatePatchProject( projectname, ...)
  82.  
  83.         APTR CreatePatchProject( STRPTR, ...);
  84.  
  85.    FUNCTION
  86.         Create an instance of a patch project.
  87.  
  88.         This instance may be used to manipulate or remove patches belonging
  89.         to one project (or program) with one function call.
  90.  
  91.         The projectname will be copied into an internal buffer.
  92.  
  93.    INPUTS
  94.         projectname = pointer to name of the patch project
  95.         taglist     = pointer to array of tags
  96.  
  97.    TAGS
  98.         none defined yet
  99.  
  100.    RESULT
  101.         project = pointer to patch projects private structure or 
  102.                   null on failure
  103.  
  104.    NOTES
  105.  
  106.    BUGS
  107.  
  108.    SEE ALSO
  109.         RemovePatchProject(), InstallPatchTags(), patch.h
  110.  
  111. patch.library/FindPatch                               patch.library/FindPatch
  112.  
  113.    NAME
  114.         FindPatch -- find a patch structure with a given name.
  115.  
  116.    SYNOPSIS
  117.         patch = FindPatch( name )
  118.         D0                 A0
  119.  
  120.         struct Patch *FindPatch( STRPTR );
  121.  
  122.    FUNCTION
  123.         This function will search the patch.library lists for a
  124.         patch structure with the given name. The first patch matching
  125.         this name will be returned.
  126.  
  127.         This function exists only for historic reasons.
  128.         It will internally be routed to FindPatchTags().
  129.  
  130.    INPUTS
  131.         name = Name of the patch structure to find
  132.  
  133.    RESULT
  134.         patch = a pointer to the patch structure with the same name else
  135.                 NULL to indicate that the string was not found.
  136.  
  137.    NOTES
  138.         If your task is not the owner of the patch, the
  139.         pointer is only valid as long as the system is in forbid().
  140.         From V2 on you may also lock the patch.library semaphore
  141.         before calling this function. In this case a pointer to
  142.         a patch structure is guaranteed to be valid, until you
  143.         release the semaphore. The semaphore, however, should be kept
  144.         locked only for short periods of time in order not to block
  145.         other tasks.
  146.  
  147.    BUGS
  148.  
  149.    SEE ALSO
  150.         InstallPatch(), RemovePatch(), patch.h
  151.  
  152. patch.library/FindPatchTagsA                     patch.library/FindPatchTagsA
  153.  
  154.    NAME
  155.         FindPatchTagsA -- find a patch structure with certain criteria. (V3)
  156.         FindPatchTags -- varargs stub for FindPatchTagsA(). (V3)
  157.  
  158.    SYNOPSIS
  159.         object = FindPatchTagsA( taglist )
  160.         D0                       A0
  161.  
  162.         APTR FindPatchTagsA( struct TagItem *);
  163.  
  164.         object = FindPatchTags( ...)
  165.  
  166.         APTR FindPatchTags( ...);
  167.  
  168.    FUNCTION
  169.         This function will search the patch.library lists for a
  170.         patch structure, that matches the criteria specified in the taglist.
  171.         The first matching patch will be returned.
  172.  
  173.    INPUTS
  174.         taglist = pointer to array of tags
  175.  
  176.    TAGS
  177.         Specify only one of these at a time:
  178.         PATT_PatchName (STRPTR) - Specifies that patch.library should
  179.                 search for the patch with the given name.
  180.         PATT_ProjectName (V4) (STRPTR) - Specifies that patch.library should
  181.                 search for the project with the given name.
  182.  
  183.  
  184.         PATT_NoCase (V4) (BOOL) - If specified with PATT_PatchName or
  185.                 PATT_ProjectName string-comparison will be case-independent.
  186.                 International characters are not respected with this version
  187.                 of patch.library.
  188.                 This may or may not change in the future.
  189.         PATT_LastObject (V4) (APTR) - This tag allows to search for multiple
  190.                 matching objects. Simply specify the result of a previous
  191.                 call to FindPatchTags() to continue searching with this tag.
  192.                 You may also specify NULL to start searching the lists from
  193.                 the beginning. Keep in mind, that you must make sure, that
  194.                 the pointer is valid (see notes).
  195.  
  196.    RESULT
  197.         object = a pointer to the object as requested within the taglist or
  198.                  NULL to indicate that no match was found.
  199.  
  200.    NOTES
  201.         If your task is not the owner of the patch, the
  202.         pointer is only valid as long as the system is in forbid().
  203.         You may also lock the patch.library semaphore
  204.         before calling this function. In this case a pointer to
  205.         a patch structure is guaranteed to be valid, until you
  206.         release the semaphore. The semaphore, however, should be kept
  207.         locked only for short periods of time in order not to block
  208.         other tasks.
  209.  
  210. patch.library/GetPatchA                               patch.library/GetPatchA
  211.  
  212.    NAME
  213.         GetPatchA -- Returns certain attributes of a patch. (V3)
  214.         GetPatch -- varargs stub for GetPatchA(). (V3)
  215.  
  216.    SYNOPSIS
  217.         Result = GetPatchA( patch, taglist )
  218.         D0                  A0     A1
  219.  
  220.         ULONG Result GetPatchA( struct Patch *, struct TagItem *);
  221.  
  222.         Result = GetPatch( patch, ...)
  223.  
  224.         ULONG Result GetPatch( struct Patch *, ...);
  225.  
  226.    FUNCTION
  227.         Returns certain attributes and lists connected to a patch (see TAGS).
  228.  
  229.    INPUTS
  230.         patch = pointer to a patch structure or NULL for no action
  231.         taglist = pointer to array of tags
  232.  
  233.    TAGS
  234.         PATT_Result2 (ULONG *) - An optional pointer to a longword,
  235.                 which will contain an errorcode as defined patch.h,
  236.                 when the function returns.
  237.                 Assembler programmers can get the same value from d1.
  238.  
  239.         Only one of the following tags may be specified at a time:
  240.  
  241.         PATT_PatchName (BOOL) - Return a pointer to a copy of the name of
  242.                 the patch in a null-terminated string.
  243.                 This pointer must be passed to PatchFreeVec(), if
  244.                 the string is no longer needed.
  245.                 Type of Result is STRPTR.
  246.         PATT_TaskListType (BOOL) - Return the type of the internal TaskList
  247.                 Possible results:
  248.                 TL_TYPE_INCLUDE: all specified tasks will use
  249.                                  the patchroutine, all others will ignore it.
  250.                 TL_TYPE_EXCLUDE: all specified tasks will ignore
  251.                                  the patchroutine, all others will use it.
  252.                 NULL:            An error occurred (this includes the absence
  253.                                  of a TaskList). Check the secondary
  254.                                  errorcode for more information.
  255.                 Type of Result is ULONG.
  256.         PATT_TaskList (BOOL) - Return a pointer to a taglist containing all
  257.                 tasknames, taskids or patterns attached to a patch.
  258.                 The tagitems are PATT_AddTaskName, PATT_AddTaskID or
  259.                 PATT_AddTaskPattern(new for V5).
  260.                 Unknown tags must be ignored.
  261.                 This pointer must be passed to PatchFreeVec(), if
  262.                 the tasklist is no longer needed.
  263.                 Type of Result is taglist.
  264.         PATT_Disabled (V4) (BOOL) - Return a number representing the current
  265.                 disable nesting counter of a patch. Null means the patch is
  266.                 enabled and will be used, by any tasks using the
  267.                 library function.
  268.                 Type of Result is ULONG.
  269.         PATT_UserData (V5) (BOOL) - Return userdata attached to a patch.
  270.                 Type of Result is ULONG.
  271.         PATT_Priority (V5) (BOOL) - Return the priority of a patch.
  272.                 Type of Result is BYTE.
  273.         PATT_Original (V6) (BOOL) - Return a pointer to the original
  274.                 function.
  275.                 Only possible, if patch was installed with PATT_Original
  276.                 Type of Result is (* )().
  277.  
  278.  
  279.    RESULT
  280.         Result = Pointer or longword depending on specified tags.
  281.  
  282.         Possible errorcodes returned with PATT_Result2 or in register d1:
  283.                 PATERR_Ok
  284.                         Indicates success of the operation.
  285.                 PATERR_OutOfMem
  286.                         Indicates that there was not enough memory to
  287.                         complete the operation.
  288.                 PATERR_InvalidHandle
  289.                         Indicates that the pointer to the patch passed
  290.                         to the function was not or is no longer valid.
  291.                         This might happen, if you pass a wrong pointer or
  292.                         you got the pointer via FindPatch() and another
  293.                         task has removed the patch before this task called
  294.                         RemovePatchTags().
  295.                 PATERR_NoTaskList
  296.                         No valid TaskList is attached to the patch.
  297.                         The SetPatchA() function with the PATT_CreateTaskList
  298.                         tag specified, must be called to allocate a TaskList.
  299.                 PATERR_PatchUnnamed
  300.                         The patch has no identification string attached
  301.                         to it.
  302.  
  303.    NOTES
  304.  
  305.    BUGS
  306.  
  307.    SEE ALSO
  308.         InstallPatchTags(), PatchFreeVec(), patch.h, patchtags.h
  309.  
  310. patch.library/InstallPatch                         patch.library/InstallPatch
  311.  
  312.    NAME
  313.         InstallPatch -- Installs a patchroutine for library functions.
  314.  
  315.    SYNOPSIS
  316.         patch = InstallPatch( newpatch )
  317.         D0                    A0
  318.  
  319.         struct Patch *InstallPatch( struct NewPatch * );
  320.  
  321.    FUNCTION
  322.         This function exists only for historic reasons. It will internally
  323.         routed back to InstallPatchTags(). Because InstallPatchTags()
  324.         has advanced features there is definitely no need to call this
  325.         function at all.
  326.  
  327.    INPUTS
  328.         newpatch = pointer to an instance of a NewPatch structure
  329.  
  330.    RESULT
  331.         patch = pointer to a patch structure or NULL on failure
  332.  
  333.    NOTES
  334.  
  335.    BUGS
  336.  
  337.    SEE ALSO
  338.         InstallPatchTags(), patchobsolete.h
  339.  
  340. patch.library/InstallPatchTagsA               patch.library/InstallPatchTagsA
  341.  
  342.    NAME
  343.         InstallPatchTagsA -- Installs a patchcode for library functions. (V2)
  344.         InstallPatchTags -- varargs stub for InstallPatchTagsA(). (V2)
  345.  
  346.    SYNOPSIS
  347.         patch = InstallPatchTagsA( funcEntry, funcOffset, taglist )
  348.         D0                         A0         D0          A1
  349.  
  350.         struct Patch *InstallPatchTagsA( APTR, UWORD, struct TagItem * );
  351.  
  352.         patch = InstallPatchTags( funcEntry, funcOffset, ...)
  353.  
  354.         struct Patch *InstallPatchTags( APTR, UWORD, ...);
  355.  
  356.    FUNCTION
  357.         Adds a user provided routine to a library function.
  358.  
  359.         NEW for V3: An internal call to SetPatch() will be made.
  360.         So all tags which are valid with SetPatch() may be specified in the
  361.         taglist.
  362.  
  363.    INPUTS
  364.         funcEntry = pointer to the entry of the function to add
  365.         funcOffset = Library Offset Vector (LVO) of the function to patch
  366.         taglist = pointer to array of tags
  367.  
  368.    TAGS
  369.         PATT_LibraryName (STRPTR) - Specifies that you want to patch a
  370.                 library of the given name
  371.                 ( as in exec.library/OpenLibrary() ).
  372.                 Either PATT_LibraryName, PATT_DeviceName or PATT_LibraryBase
  373.                 MUST be specified.
  374.         PATT_DeviceName (STRPTR) - Specifies that you want to patch a device
  375.                 of the given name ( as in exec.library/OpenDevice() ).
  376.                 Either PATT_LibraryName, PATT_DeviceName or PATT_LibraryBase
  377.                 MUST be specified.
  378.         PATT_LibraryBase (struct Library *) Specifies that you want to patch
  379.                 a library, device or resource with the given base.
  380.                 You may get such a pointer by calling one of the following
  381.                 exec functions: OpenLibrary(), OpenDevice(), OpenResource()
  382.                 You may safely close this library, if InstallPatchTags()
  383.                 returns, because patch.library will increase the OpenCount
  384.                 to make sure, that the library won't be removed from the
  385.                 system as long as there are patches installed.
  386.                 V4: The OpenCount will not be increased, if the
  387.                     PatchSupervisor support program is active.
  388.                 Either PATT_LibraryName, PATT_DeviceName or PATT_LibraryBase
  389.                 MUST be specified.
  390.         PATT_LibVersion (ULONG) - Versionnumber for exec.library/OpenLibrary.
  391.                 Optional in conjunction with PATT_LibraryName.
  392.                 Should be specified, if a function is available only
  393.                 from a certain library version on.
  394.                 Default is NULL (any version).
  395.         PATT_DevFlags (ULONG) - Flags for exec.library/OpenDevice().
  396.                 Optional in conjunction with PATT_DeviceName.
  397.                 Default is NULL.
  398.         PATT_DevUnit (ULONG) - Unit for exec.library/OpenDevice().
  399.                 Optional in conjunction with PATT_DeviceName.
  400.                 Default is NULL.
  401.         PATT_PatchName (STRPTR) - An optional pointer to a string, which can
  402.                 be used to search for a patch with FindPatch() or
  403.                 FindPatchTags().
  404.                 The null-terminated string will be copied, so you may free
  405.                 its memory when InstallPatchTags() returns. The string should
  406.                 identify the program that installed the patch.
  407.                 Even though this tag is optional, the use of it is strongly
  408.                 encouraged, because without it certain future enhancements
  409.                 of the patch.library may not work
  410.                 (e.g.: saving of user-settings).
  411.         PATT_Priority (BYTE) - Priority of the patch
  412.                 valid range: -127...+126
  413.                 It indicates the sequence of patches, if more than one patch
  414.                 for a function is to be installed.
  415.                 The original code has a priority of 0.
  416.                 Priority:    Meaning:
  417.                 >0: patch will be executed before the original
  418.                 <0: patch will be executed after the original
  419.                 =0: patch will be executed instead of the original (default)
  420.                 Normally only the priorities +5, 0, -5 should be used.
  421.         PATT_NewCodeSize (ULONG) - Optional length of the patch code to be
  422.                 installed.
  423.                 If this field is set to the correct value the PC-RELATIVE
  424.                 patch code starting at funcEntry will be copied into an
  425.                 internal buffer. So it is possible to deallocate the
  426.                 patch code after InstallPatchTags() returned.
  427.         PATT_Result2 (ULONG *) - An optional pointer to a longword,
  428.                 which will contain an errorcode as defined patch.h, when
  429.                 the function returns.
  430.                 Assembler programmers can get the same value from d1.
  431.         PATT_ProjectID (APTR) (V4) - Optional pointer to a PatchProject as
  432.                 created by a CreatePatchProject() function call, indicating
  433.                 that the newly installed patch belongs to one project or
  434.                 program.
  435.                 If used together with the RemovePatchProject() function
  436.                 many patches can be removed with one function call.
  437.         PATT_UseXResult (BOOL) (V5) - If this tag is set to TRUE,
  438.                 your patchcode MUST return a PatchXResult structure in d0.
  439.                 See PatchAlloc for more informations.
  440.         PATT_Original *((* )()) (V6) - Pointer to a longword or NULL.
  441.                 If you specify this tag you indicate, that you want to
  442.                 call the original function from within your patchcode.
  443.                 You may get this pointer by specifying a pointer
  444.                 to a longword, which will be used in your patchcode to
  445.                 call the original function (e.g.: jsr LongWord).
  446.                 If you specify NULL with this tag you can get the
  447.                 pointer to the original function by a later call to
  448.                 GetPatch().
  449.                 WARNING: Your patchcode must be ready to be called
  450.                 immediately, unless you also specify PATT_Disable,TRUE.
  451.                 So PATT_Original,NULL should always be paired with
  452.                 PATT_Disable,TRUE.
  453.                 Also note, that PATT_Priority MUST be > 0, if you specify
  454.         this tag.
  455.  
  456.  
  457.         For more tags see the description of SetPatch().
  458.  
  459.    RESULT
  460.         patch = pointer to a patch structure or NULL on failure
  461.  
  462.         Errorcodes returned with PATT_Result2, NPAT_Result2 or in 
  463.         register d1:
  464.         Note that from V3 on errorcodes may be returned, even if patch is a
  465.         valid pointer, indicating a failure in the internal SetPatch() call.
  466.         Previous versions always set PATERR_Ok, if patch was a valid pointer.
  467.                 PATERR_Ok
  468.                         Indicates success of the operation.
  469.                 PATERR_OutOfMem
  470.                         Indicates that there was not enough memory to
  471.                         complete the operation.
  472.                 PATERR_OpenLib
  473.                         The operation failed, because the exec.library
  474.                         function OpenLibrary() failed. Check the Autodocs
  475.                         for more informations about OpenLibrary().
  476.                 PATERR_OpenDev
  477.                         The operation failed, because the exec.library
  478.                         function OpenDevice() failed. Check the Autodocs
  479.                         for more informations about OpenDevice().
  480.                 PATERR_FuncNotStd
  481.                         The library offset vector of the function to patch
  482.                         was not in format that patch-library can accept.
  483.                         Patch.library can handle the following formats:
  484.                         jmp xxxxxx
  485.                         moveq.l #xx,Dx    bra.l xxxx (up to V5 only)
  486.                         moveq.l #xx,Dx    bra.s xx   (up to V5 only)
  487.                         Note that this is the type of error returned,
  488.                         if you are trying to patch a function that uses
  489.                         in-line code such as exec.library/GetCC()
  490.                 PATERR_InvalidTags
  491.                         An error occurred while parsing the specified Tags
  492.                         (e.g.: EITHER PATT_LibraryName, PATT_DeviceName or
  493.                          PATT_LibraryBase MUST be used)
  494.  
  495.         For more errorcodes see the description of SetPatch().
  496.  
  497.    NOTES
  498.         This function may implicitly call dos.library functions, so do not
  499.         call it from tasks.
  500.  
  501.    BUGS
  502.         Up to V4 it was not possible to pass pathnames with PATT_LibraryName
  503.         or PATT_DeviceName (e.g.: "Work:libs/foo.library").
  504.         This has been fixed in V5.
  505.  
  506.    SEE ALSO
  507.         RemovePatchTags(), RemovePatchProject(), SetPatch(), PatchAlloc(),
  508.         patch.h, patchtags.h, exec.library/OpenLibrary(),
  509.         exec.library/OpenDevice()
  510.  
  511. patch.library/PatchAlloc                             patch.library/PatchAlloc
  512.  
  513.    NAME
  514.         PatchAlloc -- Allocate and initialize structures (V5)
  515.  
  516.    SYNOPSIS
  517.         structure = PatchAlloc(type)
  518.                                D0
  519.  
  520.         APTR PatchAlloc(ULONG type);
  521.  
  522.    FUNCTION
  523.         Allocate and initialize structures for use with patch.library.
  524.  
  525.    NOTE
  526.         Call PatchFreeVec() to free the memory unless documented otherwise.
  527.  
  528.    INPUTS
  529.         type = type of structure to allocate
  530.  
  531.         Currently defined types:
  532.         PS_TYPE_XRESULT - Allocate a PatchXResult structure used 
  533.                           in conjunction with the Extended-Result-System
  534.                           (See Example below)
  535.  
  536.    RESULT
  537.         structure = pointer to a structure or NULL on failure
  538.  
  539.    EXAMPLE
  540.         To add 30 ticks to the each dos.library/Delay() function
  541.         your patchcode would look like this (in SAS/C):
  542.  
  543.        __asm __saveds struct PatchXResult *MyDelay(register __d1 ULONG ticks)
  544.        {
  545.                struct PatchXResult *xresult;
  546.                ticks += 30;
  547.                xresult = (struct PatchXResult *)PatchAlloc(PS_TYPE_XRESULT);
  548.                if(xresult )
  549.                {
  550.                         xresult->pxr_RegD1 = ticks;
  551.                         xresult->pxr_RegPattern = PATREG_D1;
  552.                }
  553.                return(xresult);
  554.        }
  555.  
  556.  
  557.    SEE ALSO
  558.         GetPatch(), PatchFreeVec(), patch.h
  559.  
  560. patch.library/PatchFreeVec                         patch.library/PatchFreeVec
  561.  
  562.    NAME
  563.         PatchFreeVec -- free patch.library structures (V3)
  564.  
  565.    SYNOPSIS
  566.         PatchFreeVec(memoryBlock)
  567.                      A1
  568.  
  569.         void PatchFreeVec(void *);
  570.  
  571.    FUNCTION
  572.         Free memory and structures used by patch.library. The memory will
  573.         be returned to the system pool from which it came.
  574.  
  575.    NOTE
  576.  
  577.    INPUTS
  578.         memoryBlock - pointer to the memory block to free, or NULL.
  579.  
  580.    SEE ALSO
  581.         GetPatch(), exec.library/FreeVec
  582.  
  583. patch.library/RemovePatch                           patch.library/RemovePatch
  584.  
  585.    NAME
  586.         RemovePatch -- Removes a patch installed by InstallPatch().
  587.  
  588.    SYNOPSIS
  589.         Error = RemovePatch( patch )
  590.         D0                   A0
  591.  
  592.         ULONG Error RemovePatch( struct Patch * );
  593.  
  594.    FUNCTION
  595.         This function is obsolete from V2 on, use RemovePatchTags() instead.
  596.         It effectively calls the new function
  597.         RemovePatchTags(patch, PATT_DelayedExpunge, FALSE, TAG_DONE)
  598.  
  599.    INPUTS
  600.         patch = pointer to the patch structure or NULL for no action
  601.  
  602.    RESULT
  603.         Error = errorcode as defined in patch.h.
  604.                 (for more information see RemovePatchTags() )
  605.  
  606.    NOTES
  607.  
  608.    BUGS
  609.  
  610.    SEE ALSO
  611.         RemovePatchTags(), patch.h
  612.  
  613. patch.library/RemovePatchProjectA           patch.library/RemovePatchProjectA
  614.  
  615.    NAME
  616.         RemovePatchProjectA -- Remove all patches from the same project. (V4)
  617.         RemovePatchProject -- varargs stub for RemovePatchProjectA(). (V4)
  618.  
  619.    SYNOPSIS
  620.         Error = RemovePatchProjectA( project, taglist )
  621.         D0                           A0       A1
  622.  
  623.         ULONG Error RemovePatchProjectA( APTR, struct TagItem *);
  624.  
  625.         Error = RemovePatchProject( project, ...)
  626.  
  627.         ULONG Error RemovePatchProject( APTR, ...);
  628.  
  629.    FUNCTION
  630.         Remove all patches from the given project.
  631.  
  632.         This function simplifies the way, patches can be removed:
  633.         - All patches belonging to one project will be disabled
  634.         - The function then waits (depending on PATT_Timeout) until
  635.           the usagecounters of all patches become zero
  636.         - Now all patches will be removed via RemovePatchTags()
  637.         - If all patches are removed resources connected to the
  638.           project will be deallocted
  639.  
  640.         You may call this function to cleanup a project, even if no
  641.         patch was successfully installed for this project.
  642.  
  643.    INPUTS
  644.         project = pointer to a patch project obtained via
  645.                   CreatePatchProject()
  646.         taglist = pointer to array of tags
  647.  
  648.    TAGS
  649.         same as RemovePatchTags()
  650.  
  651.    RESULT
  652.         Error = errorcode as defined in patch.h.
  653.                 same as RemovePatchTags()
  654.  
  655.    NOTES
  656.         Removing a patch routine can never be made absolutely safe.
  657.         Although patch.library does anything possible to provide methods
  658.         to minimize the chance of a crash, there will always be a
  659.         slight chance.
  660.         So minimize the number of install and remove operations.
  661.  
  662.    BUGS
  663.  
  664.    SEE ALSO
  665.         CreatePatchProject(), InstallPatchTags(), RemovePatchTags(),
  666.         patch.h, patchtags.h
  667.  
  668. patch.library/RemovePatchTagsA                 patch.library/RemovePatchTagsA
  669.  
  670.    NAME
  671.         RemovePatchTagsA -- Removes an installed patch. (V2)
  672.         RemovePatchTags -- varargs stub for RemovePatchTagsA(). (V2)
  673.  
  674.    SYNOPSIS
  675.         Error = RemovePatchTagsA( patch, taglist )
  676.         D0                        A0     A1
  677.  
  678.         ULONG Error RemovePatchTagsA( struct Patch *, struct TagItem *);
  679.  
  680.         Error = RemovePatchTags( patch, ...)
  681.  
  682.         ULONG Error RemovePatchTags( struct Patch *, ...);
  683.  
  684.    FUNCTION
  685.         Removes a patch from a library function.
  686.  
  687.         All allocated resources for that specific patch will
  688.         be deallocated.
  689.  
  690.    INPUTS
  691.         patch = pointer to a patch structure or NULL for no action
  692.         taglist = pointer to array of tags
  693.  
  694.    TAGS
  695.         PATT_TimeOut (ULONG) - The number of ticks (1/50 seconds) the
  696.                 function keeps trying to remove the patch, if another task
  697.                 is running in the patchcode.
  698.                 If the patch.library does not succeed in the given time the
  699.                 function will return PATERR_PatchInUse.
  700.                 Defaults to NULL, which means no retry.
  701.         PATT_DelayedExpunge (BOOL) - If this tag is not set to FALSE and a
  702.                 non-patch.library patch was installed after the patch.library
  703.                 patch for a specific library function the specified patch
  704.                 will nevertheless be removed.
  705.                 BUT some resources will be kept allocated by patch.library
  706.                 (e.g.: the Library Offset Vector will not be restored to its
  707.                 old state). Patch.library will try to deallocate these
  708.                 resources automatically, if the system is getting low on
  709.                 memory or if a call to a patch.library function that
  710.                 removes or installs patches is made.
  711.                 The default is TRUE !!!
  712.  
  713.    RESULT
  714.         Error = errorcode as defined in patch.h.
  715.                 PATERR_Ok
  716.                         Indicates success of the operation.
  717.                 PATERR_PatchInUse
  718.                         Indicates that some other task is using the
  719.                         installed function and the patch can't be removed.
  720.                         Your task may wait and try again later.
  721.                 PATERR_PatchInstalled
  722.                         Indicates that a patchcode has been installed for
  723.                         that function after your patch.library patch has
  724.                         been installed and your patch is the only
  725.                         patch.library patch for that function.
  726.                         If patch.library would remove your patch
  727.                         tasks would jump into deallocated memory
  728.                         Result:  blinking borders.
  729.                         Never occurs, if you pass in the tag
  730.                         PATT_DelayedExpunge with TRUE.
  731.                 PATERR_InvalidHandle
  732.                         Indicates that the pointer to the patch passed
  733.                         to the function was not or is no longer valid.
  734.                         This might happen, if you pass a wrong pointer or
  735.                         you got the pointer via FindPatch() and another
  736.                         task has removed the patch before this task called
  737.                         RemovePatchTags().
  738.                         Also keep in mind that ln_Type must be PS_TYPE_USER.
  739.  
  740.    NOTES
  741.         Removing a patch routine can never be made absolutely safe.
  742.         Although patch.library does anything possible to provide methods
  743.         to minimize the chance of a crash, there will always be a
  744.         slight chance.
  745.         So minimize the number of install and remove operations.
  746.  
  747.         This function may implicitly call dos.library functions, so do not
  748.         call it from tasks.
  749.  
  750.    BUGS
  751.  
  752.    SEE ALSO
  753.         InstallPatchTags(), RemovePatchProject(), patch.h, patchtags.h
  754.  
  755. patch.library/RemPatchNotifyA                   patch.library/RemPatchNotifyA
  756.  
  757.    NAME
  758.         RemPatchNotifyA -- Stop receiving messages, if a patch is changed.
  759.                            (V5)
  760.         RemPatchNotify -- varargs stub for RemPatchNotifyA(). (V5)
  761.  
  762.    SYNOPSIS
  763.         Error = RemPatchNotifyA( msgport, taglist )
  764.         D0                       A0       A1
  765.  
  766.         ULONG Error RemPatchNotifyA( struct MsgPort *, struct TagItem *);
  767.  
  768.         Error = RemPatchNotify( msgport, firsttag, ...)
  769.  
  770.         ULONG Error RemPatchNotify( struct MsgPort *, Tag, ...);
  771.  
  772.    FUNCTION
  773.         Stop receiving notification requests for the given messageport.
  774.         The messageport should have been used in a previous call to
  775.         AddPatchNotify(). Before deallocating your MsgPort you must
  776.         reply outstanding messages.
  777.  
  778.    INPUTS
  779.         msgport = pointer to msgport or null for no action
  780.         taglist = pointer to array of tags
  781.  
  782.    TAGS
  783.         none defined yet
  784.  
  785.    RESULT
  786.         Error = errorcode as defined in patch.h.
  787.                 PATERR_Ok
  788.                         Indicates success of the operation.
  789.  
  790.    NOTES
  791.  
  792.    BUGS
  793.  
  794.    SEE ALSO
  795.         AddPatchNotify(), patch.h
  796.  
  797. patch.library/SetPatchA                               patch.library/SetPatchA
  798.  
  799.    NAME
  800.         SetPatchA -- Changes certain attributes of a patch. (V3)
  801.         SetPatch -- varargs stub for SetPatchA(). (V3)
  802.  
  803.    SYNOPSIS
  804.         Error = SetPatchA( patch, taglist )
  805.         D0                 A0     A1
  806.  
  807.         ULONG Error SetPatchA( struct Patch *, struct TagItem *);
  808.  
  809.         Error = SetPatch( patch, ...)
  810.  
  811.         ULONG Error SetPatch( struct Patch *, ...);
  812.  
  813.    FUNCTION
  814.         Changes certain attributes of a patch (see TAGS).
  815.  
  816.    INPUTS
  817.         patch = pointer to a patch structure or NULL for no action
  818.         taglist = pointer to array of tags
  819.  
  820.    TAGS
  821.         PATT_CreateTaskList (ULONG) - Create a TaskList of the given type:
  822.                 TL_TYPE_INCLUDE:
  823.                        all specified tasks will use the patchroutine,
  824.                        all others will ignore it.
  825.                        So if no Task is specified via PATT_AddTask... tags,
  826.                        the patchroutine will be used for NO tasks!
  827.                 TL_TYPE_EXCLUDE:
  828.                        all specified tasks will ignore the patchroutine,
  829.                        all others will use it.
  830.                        So if no Task is specified via PATT_AddTask... tags,
  831.                        the patchroutine will be used for ALL tasks!
  832.         PATT_DeleteTaskList (BOOL) - Delete any existing TaskList
  833.                 This will return the patch to its default behaviour, which is
  834.                 to call the patchroutine for any task.
  835.                 It is not required to remove the TaskList, before you remove
  836.                 a patch, (via RemovePatchTags()) because this will
  837.                 automatically be done by patch.library.
  838.         PATT_AddTaskID (struct Task *) - Add a task address to the patch
  839.                                          TaskList.
  840.                 Patch.library takes care that one TaskID appears only once
  841.                 in the TaskList.
  842.                 Unlike many tags, you may specify this tag more than once
  843.                 in one taglist to add multiple tasks to the list.
  844.         PATT_AddTaskName (STRPTR) - Add a task of the given name to
  845.                                     the patch TaskList.
  846.                 The string will be copied into an internal buffer.
  847.         These tasknames are case-sensitive.
  848.                 Patch.library takes care that one TaskName appears only once
  849.                 in the TaskList.
  850.                 Unlike many tags, you may specify this tag more than once
  851.                 in one taglist to add multiple tasks to the list.
  852.         PATT_RemTaskID (struct Task *) - Remove a task address from the
  853.                                          patch TaskList
  854.                 Unlike many tags, you may specify this tag more than once
  855.                 in one taglist to add multiple tasks to the list.
  856.         PATT_RemTaskName (APTR) - Remove a task of the given name from the
  857.                                   patch TaskList.
  858.                 Unlike many tags, you may specify this tag more than once
  859.                 in one taglist to add multiple tasks to the list.
  860.         PATT_Disabled (V4) (BOOL) - Enable (False) or disable (True) a patch.
  861.                 For disabling a patch a nesting counter is provided.
  862.                 In order to restore normal patch execution, the programmer
  863.                 must provide exactly one call to 'enable'
  864.                 for every 'disable'.
  865.                 If a patch is disabled this does not mean, that no task
  866.                 continues to use the patched code. It only makes sure,
  867.                 that no further tasks enter the patch code.
  868.                 If PATT_Disabled,TRUE is set with InstallPatchTags() the
  869.                 patch will not be called until explicitly enabled
  870.                 by a call to SetPatchTags().
  871.         PATT_AddRemoveHook (V4) (struct Hook *) - Add a Hook, which is called
  872.                 by patch.library whenever a patch is removed from memory.
  873.                 Neither the Hook structure nor the hookfunction are copied
  874.                 into internal memory. So freeing these structures must be
  875.                 accomplished by the hookfunction itself.
  876.                 It must also preserve all registers.
  877.                 The hookobject (Register A2) for this hook is the patch
  878.                 structure.
  879.                 For more information about hooks see utility/hooks.h,
  880.                 utility.library/CallHook() or the RKMs.
  881.                 Unlike many tags, you may specify this tag more than once
  882.                 in one taglist to add multiple tasks to the list.
  883.         PATT_RemRemoveHook (V4) (struct Hook *) - Remove a Hook installed
  884.                 with PATT_AddRemoveHook.
  885.                 Unlike many tags, you may specify this tag more than once
  886.                 in one taglist to add multiple tasks to the list.
  887.         PATT_UserData (V5) (ULONG) - Attach userdata to a patch.
  888.                 Use this tag only, if you are the owner (creator) of the
  889.                 patch.
  890.         PATT_AddTaskPattern (V5) (STRPTR) - Add a pattern of tasknames
  891.                                             to the patch TaskList.
  892.                 The pattern may contain dos wildcards.
  893.                 Patch.library takes care that one pattern appears only once
  894.                 in the TaskList.
  895.                 Unlike many tags, you may specify this tag more than once
  896.                 in one taglist to add multiple tasks to the list.
  897.                 This tag only works with kickstart V37+.
  898.                 DO NOT USE this tag, if you patch one of the following
  899.                 dos-functions: MatchPattern() or MatchPatternNocase()
  900.         PATT_RemTaskPattern (V5) (STRPTR) - Remove a taskpattern from the
  901.                                             patch TaskList.
  902.                 Unlike many tags, you may specify this tag more than once
  903.                 in one taglist to add multiple tasks to the list.
  904.         PATT_StackSize (V5) (ULONG) - Minimum stacksize (in bytes) your
  905.                                       function requires.
  906.                 This value should be a multiple of 4 and more than 256.
  907.                 If a taskpattern (see PATT_AddtaskPattern) is active,
  908.                 at least 1500 Bytes should be specified.
  909.                 DO NOT USE this tag, if you patch one of the following
  910.                 exec-functions:
  911.                 FindTask(), AllocMem(), FreeMem() or StackSwap()
  912.                 You may specify zero to turn stack extension off.
  913.         PATT_Priority (V5) (BYTE) - Priority of the patch
  914.                 valid range: -127...+126
  915.                 It indicates the sequence of patches, if more than
  916.                 one patch for a function is installed.
  917.                 The original code has a priority of 0.
  918.                 Priority:    Meaning:
  919.                 >0: patch will be executed before the original
  920.                 <0: patch will be executed after the original
  921.                 =0: patch will be executed instead of the original (default)
  922.                 Normally only the priorities +5, 0, -5 should be used.
  923.                 Changing the priority of an active patch is a difficult
  924.                 operation. It may fail with PATERR_PatchInUse.
  925.                 You MUST NOT change the priority of a patch in respect
  926.                 to the original function (see above).
  927.  
  928.    RESULT
  929.         Error = errorcode as defined in patch.h.
  930.                 PATERR_Ok
  931.                         Indicates success of the operation.
  932.                 PATERR_OutOfMem
  933.                         Indicates that there was not enough memory to
  934.                         complete the operation.
  935.                 PATERR_PatchInUse
  936.                         Indicates that some other task is using the
  937.                         installed function and the priority of the patch
  938.                         can't be changed right now.
  939.                         Your task may wait and try again later.
  940.                 PATERR_InvalidHandle
  941.                         Indicates that the pointer to the patch passed
  942.                         to the function was not or is no longer valid.
  943.                         This might happen, if you pass a wrong pointer or
  944.                         you got the pointer via FindPatch() and another
  945.                         task has removed the patch before this task called
  946.                         RemovePatchTags().
  947.                 PATERR_NoTaskList
  948.                         No valid TaskList is attached to the patch.
  949.                         The SetPatchA() function with the PATT_CreateTaskList
  950.                         tag specified, must be called to allocate a TaskList.
  951.                 PATERR_TaskListExists
  952.                         PATT_CreateTaskList was specified, but there already
  953.                         exists a TaskList.
  954.                 PATERR_InvalidTaskList
  955.                         PATT_CreateTaskList was specified with a wrong
  956.                         parameter.
  957.                 PATERR_KickTooOld
  958.                         PATT_AddTaskPattern was used on a system with
  959.                         Kickstart V36or lower.
  960.                         (No longer possible with patch.library V6+, as
  961.                         Kickstart V37+ is required.)
  962.                 PATERR_InvalidPattern
  963.                         PATT_AddTaskPattern was used with a string,
  964.                         which contained an invalid pattern.
  965.                         See dos.library ParsePattern() for more informations.
  966.                 PATERR_Restricted
  967.                         PATT_AddTaskPattern or PATT_StackSize was used for a
  968.                         forbidden function (see TAGS).
  969.  
  970.    NOTES
  971.         Using the TaskList feature provided by this function will
  972.         (by a huge amount in the case of PATT_AddTaskPattern) increase
  973.         the stackusage of the patched function.
  974.         See PATT_StackSize for a solution.
  975.  
  976.    BUGS
  977.  
  978.    SEE ALSO
  979.         InstallPatchTags(), patch.h, patchtags.h,
  980.         dos.library/ParsePatternNoCase(), dos.library/ParsePattern()
  981.  
  982. patch.library/SetPatchProjectA                 patch.library/SetPatchProjectA
  983.  
  984.    NAME
  985.         SetPatchProjectA -- Changes certain attributes of a project. (V5)
  986.         SetPatchProject -- varargs stub for SetPatchProjectA(). (V5)
  987.  
  988.    SYNOPSIS
  989.         Error = SetPatchProjectA( project, taglist )
  990.         D0                        A0       A1
  991.  
  992.         ULONG Error SetPatchProjectA( APTR, struct TagItem *);
  993.  
  994.         Error = SetPatchProject( project, ...)
  995.  
  996.         ULONG Error SetPatchProject( APTR, ...);
  997.  
  998.    FUNCTION
  999.         Changes certain attributes of a group of patches belonging to one
  1000.         project. For now (V5) it mainly calls SetPatch() recursive for
  1001.         all patches belonging to the project.
  1002.         Certain project specific tags may be implemented later.
  1003.  
  1004.    INPUTS
  1005.         project = pointer to a patch project obtained via
  1006.                   CreatePatchProject() or NULL for no action
  1007.         taglist = pointer to array of tags
  1008.  
  1009.    TAGS
  1010.         see SetPatch() for a list of valid tags.
  1011.  
  1012.    RESULT
  1013.         Error = errorcode as defined in patch.h.
  1014.                 see SetPatch() for a list of errorcodes
  1015.  
  1016.    NOTES
  1017.         Currently (V5) SetPatchProject() stops changing patches, when any of
  1018.         the internal calls to SetPatch() return an error. Therefore when
  1019.         SetPatchProject() returns an error, some patches may have been
  1020.         changed and others not.
  1021.  
  1022.    BUGS
  1023.  
  1024.    SEE ALSO
  1025.         SetPatch(), patch.h, patchtags.h, CreatePatchProject()
  1026.  
  1027. patch.library/WaitRemovePatch                   patch.library/WaitRemovePatch
  1028.  
  1029.    NAME
  1030.         WaitRemovePatch -- Waits until it is possible to remove a patch.
  1031.  
  1032.    SYNOPSIS
  1033.         Error = WaitRemovePatch( patch )
  1034.         D0                       A0
  1035.  
  1036.         ULONG Error WaitRemovePatch( struct Patch * );
  1037.  
  1038.    FUNCTION
  1039.         This function is obsolete from V2 on, use RemovePatchTags() instead.
  1040.         It effectively calls the new function
  1041.         RemovePatchTags(patch,  PATT_TimeOut, 0x7fffffff,
  1042.                                 PATT_DelayedExpunge, FALSE,
  1043.                                 TAG_DONE)
  1044.  
  1045.    INPUTS
  1046.         patch = pointer to the patch structure or NULL for no action
  1047.  
  1048.    RESULT
  1049.         Error = errorcode as defined in patch.h.
  1050.                 (for more information see RemovePatchTags() )
  1051.  
  1052.    NOTES
  1053.  
  1054.    BUGS (?)
  1055.         This function will never return, if the patched library function
  1056.         crashed for some reason.
  1057.  
  1058.    SEE ALSO
  1059.         RemovePatchTags()
  1060.  
  1061.